<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>AngularJS基于模块化的MVC</title>
		<script type="text/javascript" src="../js/angular.min.js"></script>
	</head>

	<body>
		<!-- ng-app="myapp" 定义了一个模块 -->
		<div ng-app="myapp" ng-controller="myctrl">
			<div>
				<input ng-model="greeting">
				<p>Hello {{greeting || "World"}}</p>
				<button ng-click="change()">设置</button>
			</div>
		</div>
		<script type="text/javascript">
			// 初始化 myapp 模块 
			var myapp = angular.module("myapp", []);

			// 定义模块的控制器 
			// 依赖注入 ，$scope作用域对象，操作当前作用域视图 
			myapp.controller("myctrl", ["$scope", function($scope) {
				$scope.change = function() {
					$scope.greeting = "11期同学们";
				}
			}]);
		</script>
	</body>

</html>